/* 链接样式 */

/* ======= 去除下划线 ======= */
:is(a, a:hover, a:visited, a:active) {
  cursor: pointer !important;
  text-decoration: none;
}

#write :is(p, table) a,
a {
  color: var(--link-text-color);
  font-weight: var(--link-text-font-weight);
  border-bottom: var(--link-text-botttom-line);
  cursor: pointer !important;
  transition: all var(--link-animation-time) ease;
  position: relative;
  font-size: var(--link-text-size);
  border-bottom: 1.5px solid transparent;
}

#write a {
  position: relative;
}
/* 设置链接图标 */
#write p a:not(.md-toc-inner)::before {
  content: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1024 1024'%3E%3Cpath  d='M968.17199 417.657726l-94.507347 94.379549c-58.915331 58.915331-146.393735 70.736737-217.513869 36.870006L873.664643 331.329513a63.835592 63.835592 0 0 0 0-90.353881L783.374661 150.493952a63.835592 63.835592 0 0 0-90.353881 0L475.443012 368.13562c-33.86673-71.184033-22.045325-158.662437 36.870007-217.641668l94.315649-94.379549c74.890204-74.826304 196.299238-74.826304 271.061643 0l90.481679 90.353881c74.762405 74.890204 74.762405 196.299238 0 271.189442zM331.605257 692.681137a63.835592 63.835592 0 0 1 0-90.353881l271.061643-271.061643c24.984701-24.984701 65.36918-24.984701 90.35388 0s24.984701 65.36918 0 90.353881L421.959138 692.681137a63.835592 63.835592 0 0 1-90.353881 0zM150.833596 783.098917l90.353881 90.353881a63.835592 63.835592 0 0 0 90.35388 0l217.641668-217.641668c33.86673 71.184033 22.045325 158.662437-36.870006 217.641668l-86.392113 94.379549a191.677174 191.677174 0 0 1-271.125542 0l-98.405217-98.341317a191.783674 191.783674 0 0 1 0-271.125542l94.379549-86.392113c59.04313-58.915331 146.457634-70.736737 217.705567-36.870006L150.833596 692.681137a64.02729 64.02729 0 0 0 0 90.41778z'/%3E%3C/svg%3E");
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 0.2em;
  vertical-align: sub;
}

/* ======= 鼠标悬停样式 ======= */
#write :is(p, table) a:hover,
a:hover {
  color: var(--hover-link-text-color);
  border-bottom: 1.5px solid transparent;
  transition: color 0.3s ease;
}

/* 已被访问过的链接 */
a:visited,
  /*鼠标点中激活链接*/
  a:active {
  color: var(--link-visited-text-color);
}

/* ======= 链接 hover 样式 —— 线移动（左 ——> 右） ======= */
span:is([md-inline="link"], [md-inline="url"]).md-link {
  position: relative;
}

span:is([md-inline="link"], [md-inline="url"]).md-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  transition: transform 0.5s ease;
  height: 1.5px;
  background: linear-gradient(
    to right,
    var(--hover-link-bottom-line-start-color),
    var(--hover-link-bottom-line-end-color)
  );
  transform: scaleX(0);
  transform-origin: center right;
}

span:is([md-inline="link"], [md-inline="url"]).md-link:hover::after {
  transform: scaleX(1);
  transform-origin: center left;
}
